function Goal(){
    var id;
    var goalScoreTeam1;
    var goalScoreTeam2;
    var whichTeamScoredCurrentGoal;     // values: team1 = 1; team2 = 2
    var goalMatchMinute;
    var goalGetterName;
    var goalPenalty;                    // boolean
    var ownGoal;                        // boolean
    var overtime;                       // boolean
    var goalComment;
    var matchId;
    
    this.setId = function(goalId){
        id = goalId;
    }
    this.getId = function(){
        return id;
    }
    
    this.setGoalScoreTeam1 = function(goalScore){
        goalScoreTeam1 = goalScore;
    }
    this.getGoalScoreTeam1 = function(){
        return goalScoreTeam1;
    }
    
    this.setGoalScoreTeam2 = function(goalScore){
        goalScoreTeam2 = goalScore;
    }
    this.getGoalScoreTeam2 = function(){
        return goalScoreTeam2;
    }

    this.setwhichTeamScoredCurrentGoal = function(teamNr) {
        whichTeamScoredCurrentGoal = teamNr;
    }

    this.getWhichTeamScoredCurrentGoal = function() {
        return whichTeamScoredCurrentGoal;
    }

    this.setGoalMatchMinute = function(matchminute){
        goalMatchMinute = matchminute;
    }
    this.getGoalMatchMinute = function(){
        return goalMatchMinute;
    }
    
    this.setGoalGetterName = function(name){
        goalGetterName = name;
    }
    this.getGoalGetterName = function(){
        return goalGetterName;
    }
    
    this.setGoalPenalty = function(boolean){
        goalPenalty = boolean;
    }
    this.isGoalPenalty = function(){
        return goalPenalty;
    }

    this.setOwnGoal = function(boolean) {
        ownGoal = boolean;
    }

    this.isOwnGoal = function() {
        return ownGoal;
    }

    this.setOvertime = function(boolean) {
        overtime = boolean;
    }

    this.isOvertime = function() {
        return overtime;
    }

    this.setGoalComment = function(comment){
        goalComment = comment;
    }
    this.getGoalComment = function(){
        return goalComment;
    }
    this.setMatchId = function(id){
        matchId = id;
    }
    this.getMatchId = function(){
        return matchId;
    }
}

Goal.prototype.getDatabaseObject = function(){
    return { id                         : this.getId(),
             goalScoreTeam1             : this.getGoalScoreTeam1(),
             goalScoreTeam2             : this.getGoalScoreTeam2(),
             whichTeamScoredCurrentGoal : this.getWhichTeamScoredCurrentGoal(),
             goalMatchMinute            : this.getGoalMatchMinute(),
             goalGetterName             : this.getGoalGetterName(),
             goalPenalty                : this.isGoalPenalty(),
             ownGoal                    : this.isOwnGoal(),
             overtime                   : this.isOvertime(),
             goalComment                : this.getGoalComment(),
             matchId                    : this.getMatchId()
           };
}

Goal.prototype.convertToBusinessObject = function(dbObject){
    this.setId(dbObject.id);
    this.setGoalScoreTeam1(dbObject.goalScoreTeam1);
    this.setGoalScoreTeam2(dbObject.goalScoreTeam2);
    this.setwhichTeamScoredCurrentGoal(dbObject.whichTeamScoredCurrentGoal);
    this.setGoalMatchMinute(dbObject.goalMatchMinute);
    this.setGoalGetterName(dbObject.goalGetterName);
    this.setGoalPenalty(dbObject.goalPenalty);
    this.setOwnGoal(dbObject.ownGoal);
    this.setOvertime(dbObject.overtime);
    this.setGoalComment(dbObject.goalComment);
    this.setMatchId(dbObject.matchId);
}